<?php

namespace App\Jobs;

use App\Order;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use function GuzzleHttp\Psr7\uri_for;

class ReceivingJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    public $order_ids;

    /**
     * Create a new job instance.
     *
     * @param $order
     */
    public function __construct($order_ids)
    {
        $this->order_ids=$order_ids;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        dd($this->order_ids);

       $order=Order::whereIn('id',$this->order_ids)->get();
       foreach ($order as $v){
           if ($v['status']==1){
               Order::where('id',$v['id'])->update(['receivingStatus'=>1]);
           }
       }
    }
}
